delete __dirname
delete __filename

window = global;
window.top = window

window.addEventListener = function (res) {
    console.log("window 中的 addEventListener 接收的参数：", res)
}


div = {
    getElementsByTagName: function (res) {
        console.log("div 中的 getElementsByTagName 接收的参数：", res)
        if (res == 'i') {
            return []
        }
    }
}

meta = [
    {
        httpEquiv: "Content-Type",
        content: "text/html; charset=utf-8"
    }, {
        content: "content_code",
        parentNode: {
            removeChild: function (res) {
                console.log("meta 中的 removeChild 接收的参数：", res)
            }
        }
    }
]

document = {
    createElement: function (res) {
        console.log("document 中的 createElement 接收的参数：", res)
        if (res == 'div') {
            return div
        }
        if (res == 'form') {
            return {}
        }
    },
    getElementsByTagName: function (res) {
        console.log("document 中的 getElementsByTagName 接收的参数：", res)
        if (res == 'meta') {
            return meta
        }
        if (res == 'base') {
            return []
        }
        if (res == 'script') {
            return []
        }
    },
    addEventListener : function (res) {
        console.log("document 中的 addEventListener 接收的参数：", res)
    }
}

location = {
    "ancestorOrigins": {},
    "href": "http://iservice.10010.com/e5/query.html",
    "origin": "http://iservice.10010.com",
    "protocol": "http:",
    "host": "iservice.10010.com",
    "hostname": "iservice.10010.com",
    "port": "",
    "pathname": "/e5/query.html",
    "search": "",
    "hash": ""
}

setInterval = function (){}

setTimeout  = function (){}

function get_environment(proxy_array) {
    for (var i = 0; i < proxy_array.length; i++) {
        handler = '{\n' +
            '    get: function(target, property, receiver) {\n' +
            '        console.log("方法:", "get  ", "对象:", ' +
            '"' + proxy_array[i] + '" ,' +
            '"  属性:", property, ' +
            '"  属性类型:", ' + 'typeof property, ' +
            // '"  属性值:", ' + 'target[property], ' +
            '"  属性值类型:", typeof target[property]);\n' +
            '        return target[property];\n' +
            '    },\n' +
            '    set: function(target, property, value, receiver) {\n' +
            '        console.log("方法:", "set  ", "对象:", ' +
            '"' + proxy_array[i] + '" ,' +
            '"  属性:", property, ' +
            '"  属性类型:", ' + 'typeof property, ' +
            // '"  属性值:", ' + 'target[property], ' +
            '"  属性值类型:", typeof target[property]);\n' +
            '        return Reflect.set(...arguments);\n' +
            '    }\n' +
            '}'
        eval('try{\n' + proxy_array[i] + ';\n'
            + proxy_array[i] + '=new Proxy(' + proxy_array[i] + ', ' + handler + ')}catch (e) {\n' + proxy_array[i] + '={};\n'
            + proxy_array[i] + '=new Proxy(' + proxy_array[i] + ', ' + handler + ')}')
    }
}

proxy_array = ['window', 'document', 'navigator', 'location', 'history', 'screen']

get_environment(proxy_array)


'ts_code'

'func_code'



function get_cookie(){
    return document.cookie
}